package com.reverse;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String inputString = sc.nextLine();
        System.out.println("反转后的字符串如下：" + new StringBuilder(inputString).reverse().toString());

        char[] stringArray = inputString.toCharArray();
        String reverse = "";
        for(int i=stringArray.length-1; i>=0; i--) {
            reverse += stringArray[i];
        }
        System.out.println("反转后的字符串如下：" + reverse);
    }
}
